/*
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2023-12-14 14:14:41
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2024-01-23 15:07:49
 * @FilePath: \partal\src\config\menu\modules\develop.ts
 * @Description: 开发指南-菜单
 */

import { PLANTTYPE_ENUM } from '@/enum/globalEnum'

/** 一级开发指南菜单 */
const firstDevelop = {
  text: '开发指南',
  name: 'develop',
  path: '/develop',
  component: () => import('@/layout/layoutMenu.vue'),
  isMenu: true,
  expanded: false
}

/** 开发指南：概述 */
const developGuide = {
  text: '概述',
  name: 'developGuide',
  path: 'guide',
  fullPath: '/develop/guide',
  component: () => import('@/views/develop/guide.vue'),
  checked: false
}

/** 开发指南：快速上手 */
const developQuickStart = {
  text: '快速上手',
  name: 'developQuickStart',
  path: 'quickstart',
  fullPath: '/develop/quickstart',
  component: () => import('@/views/develop/quickStart.vue'),
  checked: false
}

/** 开发指南：贡献指南 */
const developContribute = {
  text: '贡献指南',
  name: 'developContribute',
  path: 'contribute',
  fullPath: '/develop/contribute',
  component: () => import('@/views/develop/contribute.vue'),
  checked: false
}

/** 开发指南：定制主题 */
const developTheme = {
  text: '定制主题',
  name: 'developTheme',
  path: 'theme',
  fullPath: '/develop/theme',
  component: () => import('@/views/develop/theme.vue'),
  checked: false
}

/** 二级开发指南菜单 */
const secondDevelop = (plantType: PLANTTYPE_ENUM) => {
  if (plantType === PLANTTYPE_ENUM.PC) {
    return [developGuide, developQuickStart, developContribute, developTheme]
  } else if (plantType === PLANTTYPE_ENUM.APP) {
    return [developGuide, developQuickStart]
  } else if (plantType === PLANTTYPE_ENUM.XCX) {
    return [developGuide, developQuickStart]
  } else if (plantType === PLANTTYPE_ENUM.H5) {
    return [developGuide, developQuickStart, developContribute, developTheme]
  }
  return [developGuide, developQuickStart]
}

/** 单个开发指南 */
export const getDevelop = (plantType: PLANTTYPE_ENUM) => ({
  ...firstDevelop,
  children: secondDevelop(plantType)
})

/** 所有开发指南 */
export const getAllDevelop = () => {
  return {
    ...firstDevelop,
    children: [developGuide, developQuickStart, developContribute, developTheme]
  }
}
